<!DOCTYPE html>
<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <title>sso login</title>
  <script src="./sso.js"></script>
  <script src="./jquery.js"></script>

<body>
  <div class="container">
    <h1>System SSO Ajax Login</h1>
    <form id="form1" onsubmit="return false" action="##" method="post">
      <p>用户名：<input name="username" type="text" id="username" value="qiaoximing" /></p>
      <p>密　码：<input name="password" type="password" id="username" value="b3e42ac4cefe818fa2ee75d887a5156d" /></p>
      <p><input type="button" value="登录" onclick="login()">&nbsp;</p>
    </form>
  </div>
</body>
<script>
  function login() {
    $.ajax({
      type: "post",
      url: "http://pf.com/dologin",
      data: $("#form1").serialize(),
      success: function (result) {
        if(result.code==0){
          //登录成功: 跳回原应用
          if(confirm('跳转回原应用'))
              location.href=result.data;
        }else{
          //登录失败: 给出提示信息
          alert(result.msg);
        }
      }
    })
  }
</script>

</html>